package ciyuan.Item.SkillBook;

import ciyuan.Item.ItemGroups;
import ciyuan.Item.TypeInterface.SkillBookType;
import ciyuan.Player.Skill.SkillUtils;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.EffectInstance;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;

/**
 * @author 150149
 */
public class JunglePhantom extends SkillBookType {

    private static final String lastJump = "lastJump";

    public JunglePhantom() {
        super(new Properties().tab(ItemGroups.SkillBook));
    }

    @Override
    public void keyDown(PlayerEntity playerEntity) {
        SkillUtils.setSkillColdInterval(playerEntity, this, 60 * 1000);
        if (!playerEntity.level.isClientSide) {
            playerEntity.addEffect(new EffectInstance(ciyuan.Effect.Effects.jungle_phantom, 400, 0));
        }
        SkillUtils.saveSkillCastTime(playerEntity, this);
    }

    public static void onDamage(Entity from,float damage) {
        if (from instanceof PlayerEntity) {
            PlayerEntity playerEntity=(PlayerEntity) from;
            if (playerEntity.hasEffect(ciyuan.Effect.Effects.jungle_phantom)) {
                playerEntity.setHealth(playerEntity.getHealth()+damage*0.05F);
            }
        }
    }

    @Override
    public String getSkillCastName() {
        return "JunglePhantom";
    }

    @Override
    public ITextComponent getSkillDescription() {
        return new TranslationTextComponent("ciyuan.skill.desc.27");
    }

    @Override
    public ITextComponent getSkillName() {
        return new TranslationTextComponent("ciyuan.skill.name.27");
    }
}
